import {RxDialog, Util, RxLayout} from '@lowcode/jpaas-common-lib'

/**
 *
 * 初始化配置
 *  initSetting() {
 *
 *  },
 * 获取配置
 *  getSetting() {
 *       return this.settings;
 *  },
 */

export default {
    comments: {
        RxDialog,
        RxLayout
    },
    props:{
        layerid: {
            type: String,
            default: ""
        },
        row: {
            type: Object,
            default: {}
        },
        paramMappings: {
            type: Array,
            default: []
        },
        destroy: {
            type: Function
        }
    },
    data() {
        return {
            labelCol: { span:6 },
            wrapperCol: { span:18 },
            labelCol1: { span:3 },
            wrapperCol1: { span:19 },
            title: "",
            settings:{},
            value:'',
        }
    },
    created() {
        this.init();
    },
    methods: {
        init() {
            this.title=this.row.label || this.title;
            if(!this.row.value){
                this.row['value'] = ''
            }
            if(this.initSetting){ //初始化配置方法
                this.initSetting();
            }
            else if(this.row.settings){
                this.settings=this.row.settings;
            }
            this.value=this.row.values?this.row.values:this.row.value
        },
        handleSubmit() {
            var settings=this.settings;
            //获取配置方法
            if(this.getSetting){
                settings=this.getSetting();
            }
            Util.closeWindow(this, "ok",{title:this.title,settings:settings,value:this.value});
        },
        cancel() {
            Util.closeWindow(this, "cancel");
        }
    },
    watch: {}
}